<?php
include_once("./_common.php");

$mta_this = "y".date("Y");
//$region = iconv("EUC-KR", "UTF-8", $region);

$sql = "SELECT a.store_num, a.a_name1, a.a_name2, a.a_addr1, a.a_tel, a.s_map_x, a.s_map_y, b.{$mta_this} as y_avg
            FROM manage a, month_avg b
            WHERE a.store_num = b.store_num
            AND a.a_addr1 LIKE '%$region%'
            ORDER BY store_num ASC";
$rst = sql_query($sql);

while($row = mysql_fetch_assoc($rst))
{
	$list[] = $row;
}

$result = "";

for ($i = 0; $i < count($list); $i++)
{
	$result .= $list[$i]['store_num']."<col>".$list[$i]['a_name1']."<col>".$list[$i]['a_name2']."<col>"
                    .$list[$i]['a_addr1']."<col>".$list[$i]['a_tel']."<col>".$list[$i]['s_map_x']."<col>".$list[$i]['s_map_y']."<col>"
                    .$list[$i]['y_avg']."<col>"."<col>END"."<row>";
}

echo($result);
?>